#pragma once

#include "Common.h"
#include "ThreadCache.h"

static void* ConcurrentAlloc(size_t size)
{
	//通过TLS，每个线程无锁地获取自己的专属ThreadCache对象
	if (p_TLS_ThreadCache == nullptr)
		p_TLS_ThreadCache = new ThreadCache();
	cout << std::this_thread::get_id() << ":" << p_TLS_ThreadCache << endl;
	return p_TLS_ThreadCache->Allocate(size);
}
static void ConcurrentFree(void* ptr, size_t size)
{
	assert(p_TLS_ThreadCache);
	p_TLS_ThreadCache->Deallocate(ptr, size);
}
